const express = require('express')
const app = express()

// http://127.0.0.1/api/get?callback=onSuccess&name=张智琦&age=18
app.get('/api/get', (req, res) => {
  const callback = req.query.callback
  req.query.callback = undefined
  const data = {
    status: 0,
    msg: '成功',
    data: req.query
  }
  res.send(`${callback}(${JSON.stringify(data)})`)
})

app.listen(80, () => {
  console.log('Server running at http://127.0.0.1')
})
